{extend name="public/base" /}
{block name="content"}
<form class="layui-form layui-form-pane form-search" action="{:url()}" onsubmit="return false" method="post" autocomplete="off">
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">会员id</label>
        <label class="layui-input-inline">
            <input type="number" name="member_id" value="{$member_id ?? ''}" placeholder="" class="layui-input">
        </label>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">用户名</label>
        <label class="layui-input-inline">
            <input  type="text" name="email" value="" placeholder="" class="layui-input">
        </label>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">流水号</label>
        <label class="layui-input-inline">
            <input  type="text" name="order_sn" value="" placeholder="" class="layui-input">
        </label>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">交易类型</label>
        <div class="layui-input-inline">
            <select name="flow_type" lay-search class="layui-select">
                <option value='0'>全部</option>
            {volist name="Think.config.global.TRADE_LIST_MAP" id="item" }
               <option value="{$key}">{$item}</option>
           {/volist}
            </select>
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <label class="layui-form-label">申请时间</label>
        <div class="layui-input-inline">
            <input data-date-range name="create_at" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item layui-inline">
        <button class="layui-btn layui-btn-primary"><i class="layui-icon">&#xe615;</i>搜索</button>
    </div>
</form>
<table id="FinanicalLog"  data-url="{:url('index')}" data-target-search="form.form-search"></table>
{/block}
{block name='script'}
<script>
    $(function () {
        $('#FinanicalLog').layTable({
            even: true,
            height: 'full',
            method: 'post',
            sort: {field: 'id', type: 'desc'},
            url: "{:url('index')}" ,
            where: {
                order_sn: "",
                flow_type:"",
                status: 0,
                create_at: "",
                email: "",
                member_id: 0
            },
            page: true,
            cols: [[
                {checkbox: true, fixed: true},
                {field: 'id', title: 'id', width: 80, align: 'center'},
                {field: 'member_id', title: '会员id', width: 80, align: 'center'},
                {field: 'email', title: '用户名', align: 'left', width: 170,templet:function (d){
                       return d.member.email;
                    }},
                {field: 'order_sn', title: '流水号', width: 150, align: 'left'},
                {field: 'coin_name', title: '币种名称', width: 80, align: 'center',templet:function (d) {
                      return d.coin.coin_name;
                    }},
                {field: 'before_amount', title: '交易前金额', width: 100, align: 'center'},
                {field: 'change_amount', title: '发生金额', width: 100, align: 'center',templet:function (d){
                    if (d.change_amount>0) {
                        return '<span style="color: green">+'+d.change_amount+'</span>';
                    } else {
                        return '<span style="color: red">'+d.change_amount+'</span>';
                     }
                    }},
                {field: 'after_amount', title: '交易后金额', width: 100, align: 'center'},
                {field: 'flow_type', title: '交易类型', width: 100, align: 'center',templet:function (d) {
                    return d.flow_type_text
                    }},
                {field: 'create_at', title: '申请时间', width: 150, align: 'center'},
                {field: 'remark', title: '备注', align: 'left'},
            ]]
        });
        $.menu.highlight_subnav("{:url('financial-log/index')}")
    });
</script>
{/block}
